﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/OneColumn.Master" AutoEventWireup="true"
    CodeBehind="Threads.aspx.cs" Inherits="SharingCenter.Web.Mod.Talks.Threads" ValidateRequest="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
    <asp:Literal ID="ltrTitle" runat="server"></asp:Literal>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
    a.unsorted, a.sorted{color:White;}
    a.unsorted:hover, a.sorted:hover{color:White;}
    a.sorted{background:url(../../Content/images/icons/bullet-arrow-down.png) no-repeat left center; padding-left:12px;}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1">
        <Scripts>
            <asp:ScriptReference Path="~/Mod/Talks/Threads.js" />
        </Scripts>
    </asp:ScriptManagerProxy>
    <h2 class="bb">
        <img src="../../Content/images/icons/bubble_16.png" />
        <asp:Label ID="ltrCategoryName" runat="server" Text="Label"></asp:Label></h2>
    <div class="ctn-p-b fc">
        <div class="left">
            <table>
                <tr>
                    <td>
                        <span>正在浏览:</span>
                        <asp:Label ID="lblBrowsing" runat="server">所有话题</asp:Label>
                        <span>|</span>
                        <span>搜索：</span>
                    </td>
                    <td valign="middle">
                    <asp:Panel ID="Panel2" runat="server" DefaultButton="btnSearchPost">
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td><input type="text" id="searchkeyword" style="width:100px;" name="keyword" maxlength="30" class="sz-s" /></td>
                                <td>
                                <div class="ctn-p-l">
                                <asp:ImageButton Width="20" ImageUrl="~/Content/images/Spotlight.png" runat="server"
                                ID="btnSearchPost" AlternateText="搜索" PostBackUrl="Search.aspx" OnClientClick="if($.trim($('#searchkeyword').val())=='') {alert('必须输入关键字');return false;}" />
                                <input type="hidden" name="searchCategoryId" value="<%=Request.QueryString["c"] %>" /></div></td>
                            </tr>
                        </table>
                        </asp:Panel>
                    </td>
                    <td>|</td>
                    <td><asp:HyperLink runat="server" ID="lnkMy" CssClass="pointer" Text="显示" />
            <ajaxctrltool:HoverMenuExtender ID="HoverMenuExtender1" runat="server" TargetControlID="lnkMy"
                PopupControlID="Panel1" PopDelay="0" PopupPosition="Bottom">
            </ajaxctrltool:HoverMenuExtender>
            <asp:Panel ID="Panel1" runat="server" CssClass="bdr-all cxtm" Width="100">
                <ul>
                    <li>
                        <asp:HyperLink ID="lnkMyThreads" runat="server" OnInit="lnkMyThreads_Init">我发表的话题</asp:HyperLink></li>
                    <li>
                        <asp:HyperLink ID="lnkMyReplies" runat="server" OnInit="lnkMyReplies_Init">我参与的话题</asp:HyperLink></li>
                    <li>
                        <asp:HyperLink ID="HyperLink1" runat="server" OnInit="lnkAllThreads_Init">所有话题</asp:HyperLink></li>
                    <li>
                        <asp:HyperLink ID="lnkMySignature" runat="server" OnInit="lnkMySignature_Init" CssClass="openmodalformbutton-nostyle pointer">我的签名</asp:HyperLink></li>
                </ul>
            </asp:Panel></td>
                </tr>
            </table>
        </div>
        <div class="right">
            <asp:HyperLink OnPreRender="lnkCreateThread_PreRender" ID="lnkCreateThread" runat="server"
                CssClass="addbutton">发表话题</asp:HyperLink>
            
            <div class="dialogform" title="设置我的签名">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <div>
                            <%--<myuc:Editor Height="100" EditorType="Simple" Width="500" runat="server" ID="SignatureEditor" />--%>
                            <asp:TextBox ID="txtSignature" Width="500" Rows="5" TextMode="MultiLine" runat="server"></asp:TextBox>
                        </div>
                        <div class="actionarea textfar">
                            <asp:LinkButton ID="btnSignature" runat="server" CssClass="submitbutton savesig">确定</asp:LinkButton>
                            <a class="closemodalformbutton">取消</a>
                        </div>
                    </ContentTemplate>
                    <Triggers>
                        <%--<asp:PostBackTrigger ControlID="btnSignature" />--%>
                    </Triggers>
                </asp:UpdatePanel>
            </div>
            <%--<asp:HyperLink OnPreRender="lnkCreateThread_PreRender" ID="HyperLink1" runat="server" CssClass="addbutton">我的</asp:HyperLink>--%>
        </div>
    </div>
    <div>
        <asp:ListView ID="ListView1" runat="server" DataSourceID="LinqDataSource1" DataKeyNames="ThreadId">
            <ItemTemplate>
                <tr class="ti">
                    <td class="r">
                        <asp:Label ID="TotalPostsLabel" runat="server" Text='<%# Convert.ToInt32(Eval("TotalPosts"))-1 %>' />
                    </td>
                    <td class="v">
                        <asp:Label ID="ViewCountLabel" runat="server" Text='<%# Eval("ViewCount") %>' />
                    </td>
                    <td class="t">
                        <table cellspacing="0" cellpadding="0" class="nobdr">
                            <tr>
                                <td>
                                    <span class="litetext sz-s">[<%# WebConsts.THREAD_TYPE[Convert.ToInt16(Eval("ThreadType"))] %>]</span>
                                    
                                </td>
                                <td>
                                    <asp:Image Width="16" ID="Image1" runat="server" ImageUrl='<%#Eval("ThreadIcon", "~/Content/images/threadicons/{0}") %>'
                                        Visible='<%#Eval("ThreadIcon").ToString()!=""%>' />
                                    <asp:HyperLink ID="MainPostIdLabel" runat="server" 
                                        NavigateUrl='<%#Eval("ThreadId", "~/Mod/Talks/Thread.aspx?t={0}&u=1") %>'>
                                        
                                        

                                        <%# Eval("PostTitle") %>
                                        </asp:HyperLink>
                                </td>
                                <td>
                                    <asp:Panel runat="server" CssClass="nss ns-hot" title="精彩话题" ID="pnHot">
                                    </asp:Panel>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td class="cu">
                        <cc:AvatarImage runat="server" UserId='<%# Eval("CreatorUserId") %>' AlternateText=""
                            AvatarType="Tiny" />
                        <cc:NickNameLink runat="server" UserId='<%# Eval("CreatorUserId") %>' />
                    </td>
                    <td class="cd">
                        <asp:Label ID="Label1" runat="server" Text='<%# SharingCenter.Web.Classes.Utility.FriendlyDateTime(Eval("CreateDate"), SharingCenter.Web.Classes.TimeDisplayEnum.LiteralHours, false) %>' />
                    </td>
                    <td class="lu">
                        <asp:Label ID="LastUpdateLabel" runat="server" Text='<%# SharingCenter.Web.Classes.Utility.FriendlyDateTime(Eval("LastUpdate"), SharingCenter.Web.Classes.TimeDisplayEnum.LiteralHours, false) %>' />
                    </td>
                </tr>
            </ItemTemplate>
            <EmptyDataTemplate>
                <div class="litetext">
                    目前没有话题。</div>
            </EmptyDataTemplate>
            <LayoutTemplate>
                <table id="itemPlaceholderContainer" runat="server" border="0" class="tlist" cellspacing="0">
                    <tbody>
                        <tr id="Tr1" runat="server" class="th">
                            <th class="r">
                                <asp:HyperLink CssClass="unsorted" ToolTip="按照回复从多到少排序" rel="TotalPosts" Text="回复" OnPreRender="GenerateOrderByLink" ID="lnkOrderByReply" runat="server" />
                            </th>
                            <th  class="v">
                                <asp:HyperLink CssClass="unsorted" ToolTip="按照阅读从多到少排序" rel="ViewCount" Text="阅读" OnPreRender="GenerateOrderByLink" ID="HyperLink2" runat="server" />
                            </th>
                            <th  class="t">
                                主题
                            </th>
                            <th  class="cu">
                                作者
                            </th>
                            <th  class="cd">
                                <asp:HyperLink CssClass="unsorted" ToolTip="按照发表时间从最近到最早排序" rel="CreateDate" Text="发表时间" OnPreRender="GenerateOrderByLink" ID="HyperLink3" runat="server" />
                            </th>
                            <th class="lu">
                                <asp:HyperLink CssClass="unsorted" ToolTip="按照最后更新从最近到最早排序" rel="LastUpdate" Text="最后更新" OnPreRender="GenerateOrderByLink" ID="HyperLink4" runat="server" />
                            </th>
                        </tr>
                        <tr id="itemPlaceholder" runat="server">
                        </tr>
                    </tbody>
                </table>
                <div class="actionarea">
                <asp:DataPager ID="DataPager1" runat="server" PageSize="30" QueryStringField="p">
                        <Fields>
                            <asp:NextPreviousPagerField ButtonType="Link" FirstPageText="首页" ShowFirstPageButton="True"
                                ShowNextPageButton="False" ShowPreviousPageButton="False" />
                            <asp:NumericPagerField />
                            <asp:NextPreviousPagerField ButtonType="Link" LastPageText="末页" ShowLastPageButton="True"
                                ShowNextPageButton="False" ShowPreviousPageButton="False" />
                        </Fields>
                    </asp:DataPager>
                </div>
            </LayoutTemplate>
        </asp:ListView>
        <%--<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="SharingCenter.Web.Classes.scDataContext"
            EnableDelete="True" EnableUpdate="True" TableName="ThreadWithMainPosts"
            AutoGenerateWhereClause="True" AutoGenerateOrderByClause="True">
            <WhereParameters>
                <asp:QueryStringParameter DbType="Guid" Name="CategoryId" QueryStringField="c" />
            </WhereParameters>
            <OrderByParameters>  
                <asp:Parameter DefaultValue="IsRecommended desc" Name="IsRecommended" />
                
            </OrderByParameters>
        </asp:LinqDataSource>--%>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ></asp:LinqDataSource>
    </div>
</asp:Content>
<%--<asp:Content ID="Content4" ContentPlaceHolderID="RightSidebarContentPlaceHolder" runat="server">
    <div class="ctn2 normal">
    <h2 class="bb">我的话题</h2>
    </div>
</asp:Content>--%>